package j2024.j202408;

import java.io.*;

import java.util.*;

public class j0802 {

    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        int[] arr = new int[10];
        int a = 0;
        int count = 0;
        while(n!=0){
            arr[a++] = (int)(n%10);
            n/=10;
            count++;
        }

        for (int i = 0; i < count; i++) {
            if(arr[i]%2==0){
                arr[i] = 0;
            }else {
                arr[i]  = 1;
            }
        }
        long ret = 0;
        for (int i = count-1; i >=0; i--) {
            ret=ret*10+arr[i];
        }
        System.out.println(ret);
    }


    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
   // public static Read in = new Read();
    public static void main2(String[] args) {
        Scanner  in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        long[][] arr = new  long[n][m];
        long[] r = new long[n];
        long[] c = new long[m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = in.nextLong();
                r[i] += arr[i][j];
                c[j] += arr[i][j];
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                out.print(r[i]+c[j]-arr[i][j]+" ");
            }
            out.println();
        }
        out.close();
    }

    public static void maine(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        long[] ai = new long[n];
        long[] bi = new long[n];
        for (int i = 0; i < n; i++) {
            ai[i] = in.nextLong();
        }
        for (int i = 0; i < n; i++) {
            bi[i] = in.nextLong();
        }
        int date = 0;
        long maxhappy = Long.MIN_VALUE;
        long maxshame = Long.MIN_VALUE;
        long sumhappy = 0;
        long sumshame = 0;
        int right = 0,left = 0;
        while(right<n){
                sumshame+=bi[right];
                sumhappy+=ai[right];
            while(right-left+1>k){
                sumshame-=bi[left];
                sumhappy-=bi[left];
                left++;
            }
            if(right-left+1==k){
                if(sumhappy>maxhappy){
                    date = left+1;
                    maxhappy = sumhappy;
                    maxshame = sumshame;
                }else if(sumhappy==maxhappy){
                    if(maxshame>sumshame){
                        date = left+1;
                        maxshame = sumshame;

                    }
                }
            }
            right++;

        }

        System.out.println(date);
    }

    List<List<Integer>> ret;
    List<Integer> path;
    int count = 0;
    int t = 0;

    /**
     * 39. 组合总和
     * @param candidates
     * @param target
     * @return
     */
    public List<List<Integer>> combinationSum(int[] candidates, int target) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        t = target;
        dfs(candidates,0);
        return ret;
    }
    public void dfs(int[] can,int pos){
        if(count==t) {
            ret.add(new ArrayList<>(path));
            return;
        }else if(count>t){
            return;
        }
        for (int i = 0; i < can.length; i++) {
            if(pos>i){
                continue;
            }
            count+=can[i];
            path.add(can[i]);
            dfs(can,i);
            count-=can[i];
            path.remove(path.size()-1);
        }
    }
    public void dfs2(int[] can,int pos,int sum){
        if(sum==t){
            ret.add(new ArrayList<>(path));
            return;
        }
        if(sum>t||pos==can.length){
            return;
        }
        for (int i = 0; i*can[pos]+sum <= t; i++) {
            if(i!=0){
                path.add(can[pos]);
            }
            dfs2(can,pos+1,sum+i*can[pos]);
        }
        for (int i = 1; i*can[pos]+sum <= t; i++) {
            path.remove(path.size()-1);
        }
    }

    List<String> str;
    StringBuilder sb;
    public List<String> letterCasePermutation(String s) {
        str = new ArrayList<>();
        sb = new StringBuilder();
        char[] ss = s.toCharArray();
        change(ss,0);
        return str;
    }
    public void change(char[] s,int pos){
        if(pos==s.length){
            str.add(sb.toString());
            return;
        }
        if(s[pos]<'0' || s[pos]>'9'){
            char tmp  = reverse(s[pos]);
            sb.append(tmp);
            change(s,pos+1);
            sb.deleteCharAt(sb.length()-1);
        }
        sb.append(s[pos]);
        change(s,pos+1);
        sb.deleteCharAt(sb.length()-1);
    }
    public char reverse(char ch){
        if(ch>='a' && ch<='z'){
            return (char)(ch-32);
        }else {
            return (char)(ch+32);
        }
    }
}
